package chapters15_bingfa.chapters15_3;

/**
 * Created by xinxuchu on 2020/1/29.
 * 使用MyLatch的工作子线程
 */
public class Worker extends Thread {

    MyLanch myLanch;

    public Worker(MyLanch myLanch) {
        this.myLanch = myLanch;
    }

    @Override
    public void run(){
        try {
            Thread.sleep((int)(Math.random()*1000));
            //线程就这一方法，到这就执行完了，所以就执行countdown方法，数量简一
            this.myLanch.countDown();
        }catch (InterruptedException e){

        }
    }
}
